//编辑canvase绘画相关代码
/*canvas界面绘制部分使用请调用*/
function TDrawCanvas(canvas){
	//条件轴的两个状态：默认和完成
	conditionState0 = "#000000";
	conditionState1 = "#6D8637";
	//检查点3个状态，默认，满足，不满足
	checkState0 = "#000000";
	checkState1 = "#00ff00";
	checkState2 = "#ff0000";
	//被点击时的对象的边框颜色
	selectColor = '#1ecc21';
	spaceNum = 50;
	//选中或者执行成功的底色
	selectedColor = '#064e06';
	//外部参数的控件底色
	externalColor = '#386184';
	//执行失败的底色
	failColor = '#c12c2c';
	//循环标示
	imgXunHuan = new Image();
	imgXunHuan.src = '../../images/xunhuan.png';
	//分支标示
	imgFenZhi = new Image();
	imgFenZhi.src = '../../images/fenzhi.png';
	//条件控件
	imgTiaoJian = new Image();
	imgTiaoJian.src = '../../images/tiaojian.png';
	//引导箭头
	guideJianTou = new Image();
	guideJianTou.src = '../../images/jiantou.png';
	var tdraw = new TDraw(canvas);
	//获取绘图组成的控件
	this.getDrawing = function(type, param) {
		var drawing = {};
		switch(type) {
			case "coordinate"://包含虚线的坐标系
				drawing = new Coordinate(param,tdraw);
				break;
			case "conditionArea"://绘制条件轴区域
				drawing = new ConditionArea(param,tdraw);
				break;
			case "signal"://绘制信号图形
				drawing = new Signal(param,tdraw);
				break;
			case "kvalueMap"://绘制公里标图
				drawing = new KvalueMap(param,tdraw);
				break;
			case "graph"://绘制右上方的模式曲线示意图
				drawing = new Graph(param,tdraw);
				break;
			case "diagonal"://绘画内部小矩形
				drawing = new Diagonal(param,tdraw);
				break;
			case "rediagonal"://绘画内部小矩形
				drawing = new ReDiagonal(param,tdraw);
				break;
			case "thumbnails"://绘制基本用例矩形
				drawing = new Thumbnails(param,tdraw);
				break;//在画布上绘制才车站信息
			case "trainStation"://在画布上绘制才车站信息
				drawing = new TrainStation(param,tdraw);
				break;
			case "teleseme"://在画布上绘制信号机信息
				drawing = new Teleseme(param,tdraw);
				break;
			case "coordinateLeft"://包含虚线的坐标系
				drawing = new CoordinateLeft(param,tdraw);
				break;
			case "branch"://分支
				drawing = new Branch(param,tdraw);
				break;
			case "loop"://循环
				drawing = new Loop(param,tdraw);
				break;
			case "guide"://引导箭头
				drawing = new Guide(param,tdraw);
				break;
			default:
		}
		return drawing;
	};
	
	//包含虚线的坐标系
	function Coordinate(params,tdraw){
		this.param = params || {//设置参数
			elementTypes:elementTypes,
			hPoint:{x1:35,y1:660,x2:canvase_width,y2:660},
			vPoint:{x1:95,y1:50,x2:95,y2:690},
			dashPoint:{x1:10,y1:150,x2:canvase_width,y2:(150 + 40 * i)},
			dashSpace:40,
			conditionState:0//条件轴的状态，0：默认状态，1：完成测试状态
		},
		this.draw = function() {
			//横坐标系
			var hLine = tdraw.getShap('line',this.param.hPoint);
			
			if(this.param.color){
				hLine.normalStyle.stroke = this.param.color;
			}
			hLine.draw();
			//纵坐标系
			var vLine = tdraw.getShap('line',this.param.vPoint);
			if(this.param.color){
				vLine.normalStyle.stroke = this.param.color;
			}
			vLine.draw();
			//写名称画虚线
			for (var i = 0; i < this.param.elementTypes.length; i++) {
				var dashLine = tdraw.getShap('line',{x1:this.param.dashPoint.x1,y1:(this.param.dashPoint.y1 + this.param.dashSpace * i),x2:this.param.dashPoint.x2,y2:(this.param.dashPoint.y2 + this.param.dashSpace * i)});
				dashLine.isLabel = true;
				dashLine.label = {value:this.param.elementTypes[i].text,point:{x:this.param.dashPoint.x1,y:(this.param.dashPoint.y1 - 15 + this.param.dashSpace * i)},labelStyle:'20px Arial'};
				dashLine.isDash = true;
				dashLine.normalStyle={lineDash:[ 15, 5 ],lineWidth:0.5};
				if(this.param.color){
					dashLine.normalStyle.stroke = this.param.color;
				}
				dashLine.draw();
			}
		};
	};
	
	//绘制条件轴区域
	function ConditionArea(params,tdraw){
		this.param = params || {//设置参数
			obj:obj,
			elementTypes:elementTypes,
			recPoint:{x:obj.x,y:660,width:-40,height:-20},
			linePoint:{x1:(obj.x - 20),y1:640,x2:(obj.x - 20),y2:110},
			conditionState:0,//条件轴的状态，0:未完成，1:已完成
			
			
			signalObj:signalObj,
			linePoint:{x1:obj.x,y1:660,x2:obj.x,y2:600},
			circlePoint:{x:obj.x,y:580,r:20}
		},
		this.draw = function() {
			//条件轴坐标原点为下面小矩形右下角顶点
			var smallRect = tdraw.getShap('rect',{x: this.param.obj.x,y: 660,width: -40,height: -20});
			
			if(this.param.conditionState == 1 || this.param.obj.selected){//完成状态
				smallRect.filled = true;
				smallRect.filledColor = conditionState1;
			}
			smallRect.draw();
			
			//绘制矩形上的虚线
			var dashLine = tdraw.getShap('line',{x1:(this.param.obj.x - 20),y1:640,x2:(this.param.obj.x - 20),y2:110});
			dashLine.isDash = true;
			if(this.param.conditionState == 1 || this.param.obj.selected){//完成状态
				dashLine.normalStyle={lineDash:[ 15, 5 ],lineWidth:2};
			}else{
				dashLine.normalStyle={lineDash:[ 15, 5 ],lineWidth:0.5};
			}
			
			//完成状态
			if(this.param.conditionState == 1 || this.param.obj.selected){
				dashLine.normalStyle.stroke = conditionState1;
			}
			dashLine.draw();
			
			//三角形
			var myTriangle = tdraw.getShap('triangle',{x1:(this.param.obj.x - 20), y1:110, x2:(this.param.obj.x - 40), y2:90, x3:this.param.obj.x, y3:90});
			myTriangle.filled = true;
			//完成状态
			if(this.param.conditionState == 1 || this.param.obj.selected){
				myTriangle.filledColor = conditionState1;
			}else{//默认状态
				myTriangle.filledColor = this.param.obj.color;
			}
			myTriangle.draw();
			
			//矩形区域
			var areaRect = tdraw.getShap('rect',{x: (this.param.obj.x - 20),y: 110,width: this.param.obj.width,height: 40 * elementTypes.length});
			if(this.param.conditionState == 1 || this.param.obj.selected){//完成状态
				areaRect.selected = true;
				areaRect.selectStyle = {stroke:conditionState1};
			}
			areaRect.normalStyle={strokeWidth:2};
			areaRect.draw();
			
			objx = this.param.obj.x - 20;
			//绘制辅助虚线
			for(var i=1;i<this.param.obj.width/90;i++){
				var assistLine = tdraw.getShap('line',{x1:(objx + 90 * i),y1:110,x2:(objx + 90 * i),y2:(110+40 * elementTypes.length)});
				assistLine.isDash = true;
				assistLine.normalStyle={lineDash:[ 15, 5 ],lineWidth:0.5};
				//完成状态
				if(this.param.conditionState == 1){
					assistLine.normalStyle.stroke = conditionState1;
				}
				assistLine.draw();
			}
			var childrens = this.param.obj.children;
			if (childrens) {//条件轴内所有的元素
				for (var j = 0; j < childrens.length; j++) {//遍历条件轴内所有的元素
					var myRect = tdraw.getShap('rect',{x: childrens[j].x,y: childrens[j].y,width: childrens[j].width,height: childrens[j].hight,textWidth:68});
					myRect.normalStyle.stroke = stroke;
					// 矩形内插入文字
					myRect.isLabel = true;
					myRect.label = {value:childrens[j].text,point:{x:(childrens[j].x),y:(childrens[j].y + 10)}};
					myRect.label.labelStyle = '14px Arial';
					myRect.isTextBaseline = true;
					myRect.textBaseline = 'hanging';
					//如果是默认画小矩形
					if(childrens[j].fontcolor!=="#000000"){
						/*绘制生成元素的矩形*/
						//完成状态
						if(this.param.conditionState == 1){
							myRect.label.fontColor = "#ffffff";
						}else{
							myRect.label.fontColor = "#00AAAA";
						}
						if(childrens[j].state == 1 || childrens[j].state == 2){
							myRect.label.fontColor = "#ffffff";
						}
						if(childrens[j].state == 3){
							myRect.label.fontColor = "#00AAAA";
						}
					}else{//如果是点击重绘的画
						/*绘制生成元素的矩形*/
						myRect.label.fontColor = selectColor;
						myRect.normalStyle.stroke = selectColor;
					}
					//完成状态
					if(this.param.conditionState == 1 || childrens[j].state == 1){
						myRect.filled = true;
						myRect.filledColor = conditionState1;
					}
					
					if(childrens[j].state == 2){
						myRect.filled = true;
						myRect.filledColor = '#ff0000';
					}
					if(childrens[j].state == 3){
						myRect.filled = false;
					}
					
					myRect.draw();
				}
			}
			
			if(this.param.signalObj && this.param.signalObj.isShow){
				var signalLine = tdraw.getShap('line',{x1:this.param.signalObj.x,y1:660,x2:this.param.signalObj.x,y2:600});
				if(this.param.conditionState == 1 || this.param.obj.selected){
					signalLine.normalStyle.stroke = conditionState1;
				}else{
					signalLine.normalStyle.stroke = this.param.color;
				}
				
				signalLine.draw();
				/*竖线上的圆形*/
				var signalCircle = tdraw.getShap('circle',{x:this.param.signalObj.x,y:580,r:20});
				if(this.param.conditionState == 1 || this.param.obj.selected){
					signalCircle.normalStyle.stroke = conditionState1;
				}else{
					signalCircle.normalStyle.stroke = this.param.color;
				}
				signalCircle.draw();
				
				var signalName = tdraw.getShap('text',{x:this.param.signalObj.x,y:580 - 30,value:this.param.obj.signalName});
				signalName.fontStyle='14px Arial';
				signalName.draw();
			}
		};
	};
	
	//绘制信号图形
	function Signal(params,tdraw){
		this.param = params || {//设置参数
			obj:obj,
			linePoint:{x1:obj.x,y1:660,x2:obj.x,y2:600},
			circlePoint:{x:obj.x,y:580,r:20}
		},
		this.draw = function() {
			var signalLine = tdraw.getShap('line',{x1:this.param.obj.x,y1:660,x2:this.param.obj.x,y2:600});
			signalLine.normalStyle.stroke = this.param.color;
			signalLine.draw();
			/*竖线上的圆形*/
			var signalCircle = tdraw.getShap('circle',{x:this.param.obj.x,y:580,r:20});
			signalCircle.normalStyle.stroke = this.param.color;
			signalCircle.draw();
		};
	};
	//绘制公里标图
	function KvalueMap(params,tdraw){
		this.param = params || {//设置参数
			obj:obj,
			linePoint:{x1:obj.x,y1:660,x2:obj.x,y2:600},
			rectPoint:{x: (obj.x + 35),y: 600,width: -70,height: -30},
			labelPoint:{x:(obj.x + 35),y:590}
		},
		this.draw = function() {
			//竖线绘制完成
			var kiloLine = tdraw.getShap('line',{x1:this.param.obj.x,y1:660,x2:this.param.obj.x,y2:600});
			if(this.param.obj.isSelected){
				kiloLine.normalStyle['stroke'] = conditionState1;
			}
			kiloLine.normalStyle.lineWidth =1;
			kiloLine.draw();
			/*K值上的矩形*/
			var kiloRect = tdraw.getShap('rect',{x: (this.param.obj.x + 35),y: 600,width: -70,height: -30});
			kiloRect.isLabel = true;
			var text = "K0.101"; //矩形内的文本内容 
			kiloRect.label={value:text,point:{x:(this.param.obj.x+35),y:590},labelStyle:"18px Courier New",fontColor:"#d6d6d6"};
			kiloRect.normalStyle.strokeWidth=1;
			if(this.param.obj.isSelected){
				kiloRect.normalStyle.stroke = conditionState1;
			}
			kiloRect.draw();
		};
	};
	//绘制右上方的模式曲线示意图
	function Graph(params,tdraw){
		this.param = params || {//设置参数
			rectPoint:{x: 625,y: 5,width: 175,height: 80},
			textPoint:{x:625,y:10}
		},
		this.draw = function() {
			var ctx = canvas.getContext('2d');
			/*右上方的矩形示意图*/
			var myRect = tdraw.getShap('rect',{x: 625,y: 5,width: 175,height: 80});
			myRect.draw();
			
			var text = "曲线示意图";
			var myText = tdraw.getShap('text',{x:625,y:10,value:text});
			myText.draw();
			
			var img = new Image(); /*绘制图片*/
			img.src = "../../images/curve.PNG";
			img.onload = function() {
				ctx.drawImage(img, 625, 25);
			};
		};
	};
	//绘画内部小矩形
	function Diagonal(params,tdraw){
		this.param = params || {//设置参数
			obj:obj
		},
		this.draw = function() {
			var myRect = tdraw.getShap('rect',{x: this.param.obj.x,y: this.param.obj.y,width: this.param.obj.width,height: this.param.obj.height,textWidth:68});
//			myRect.normalStyle.stroke = this.param.obj.color;
			myRect.normalStyle.stroke = 'rgb(0,101,179)';
			
			if(this.param.obj.stateType == 2){//有外部参数的控件
				myRect.filled = true;
				myRect.filledColor = externalColor;
			}
			if(this.param.obj.selected){//选中的颜色
				myRect.filled = true;
				myRect.filledColor = selectedColor;
			}
			
			myRect.selected = this.param.obj.selected;
			
			if(this.param.obj.stateType == 3){//自动测试执行失败
				myRect.filled = true;
				myRect.filledColor = failColor;
			}
			// 矩形内插入文字
			myRect.isLabel = true;
			myRect.label = {value:this.param.obj.text,point:{x:(this.param.obj.x),y:(this.param.obj.y + 10)}};
			if(this.param.obj.fontcolor!=="#000000"){//如果是默认画小矩形
				/*绘制生成元素的矩形*/
				myRect.isTextBaseline = true;
				myRect.textBaseline = 'hanging';
				if(this.param.obj.stateType == 2 && !this.param.obj.selected){//有外部参数的控件
					myRect.label.fontColor = "#cccccc";
				}else{
//					myRect.label.fontColor = "#00AAAA";
					myRect.label.fontColor = "#ffffff";
				}
				
			}else{//如果是点击重绘的画
				/*绘制生成元素的矩形*/
				myRect.isTextBaseline = true;
				myRect.textBaseline = 'hanging';
				if(this.param.obj.stateType == 2 && !this.param.obj.selected){//有外部参数的控件
					myRect.label.fontColor = "#cccccc";
				}else{
//					myRect.label.fontColor = this.param.obj.fontcolor;
					myRect.label.fontColor = "#ffffff";
				}
			}
			myRect.label.labelStyle = '14px Arial';
			myRect.draw();
		};
	};
	//绘画内部小矩形
	function ReDiagonal(params,tdraw){
		this.param = params || {//设置参数
			obj:obj
		},
		this.draw = function() {
			/*绘制生成元素的矩形*/
			var myRect = tdraw.getShap('rect',{x: this.param.obj.x,y: this.param.obj.y,width: this.param.obj.width,height: this.param.obj.hight});
//			myRect.normalStyle.stroke = this.param.obj.color;
			myRect.normalStyle.stroke = selectColor;
			myRect.isTextBaseline = true;
			myRect.textBaseline = 'hanging';
//			myRect.filled = true;
//			myRect.filledColor = "#00AAAA";
			myRect.isLabel = true;
			myRect.label = {value:this.param.obj.text,point:{x:(this.param.obj.x),y:(this.param.obj.y + 10)},labelStyle:'20px Arial',fontColor:selectColor,textWidth:68};
//			if(this.param.obj.text.length>3){
				myRect.label.labelStyle = "14px Arial";
//			}else{
//				myRect.label.labelStyle = "20px Arial";
//			}
			myRect.draw();
		};
	};
	//绘制基本用例矩形
	function Thumbnails(params,tdraw){
		this.param = params || {//设置参数
			baseCase:baseCase,
			color:color
		},
		this.draw = function() {
			var myRect = tdraw.getShap('process',{x: this.param.baseCase.x,y: this.param.baseCase.y,width: this.param.baseCase.width,height: this.param.baseCase.height});
			myRect.normalStyle.stroke = this.param.color; //矩形内的颜色
			myRect.isLabel = true;
			myRect.label = {value:this.param.baseCase.name,point:{x:(this.param.baseCase.x),y:27},labelStyle:'20px Arial',fontColor:'#D6D6D4'};
			myRect.filled = this.param.filled;
			myRect.filledColor = this.param.filledColor;
			myRect.selected = this.param.selected;
			myRect.draw();
		};
	};
	//在画布上绘制才车站信息
	function TrainStation(params,tdraw){
		this.param = params || {//设置参数
			name:name,
			x:x,
			linePoint:{x1:x,y1:70,x2:x,y2:110},
			circlePoint:{x:x,y:55,r:8},
			bigCircle:{x:x,y:55,r:15}
		},
		this.draw = function() {
			var myLine = tdraw.getShap('line',{x1:this.param.x,y1:70,x2:this.param.x,y2:110});
			myLine.isLabel = true;
			myLine.label={value:this.param.name,point:{x:(this.param.x-10),y:35},labelStyle:'11px Arial'};
			myLine.normalStyle['stroke'] = "#d6d6d6";
			myLine.draw();
		    
		  //画小圆
			var myCircle = tdraw.getShap('circle',{x:this.param.x,y:55,r:8});
			myCircle.normalStyle.stroke = "#d6d6d6";
			myCircle.draw();
		    //画大圆粗线条
			var bigCircle = tdraw.getShap('circle',{x:this.param.x,y:55,r:15});
			bigCircle.normalStyle.lineWidth = 3;
			bigCircle.normalStyle.stroke = "#d6d6d6";
			bigCircle.draw();
		};
	};
	//在画布上绘制信号机信息
	function Teleseme(params,tdraw){
		this.param = params || {//设置参数
			name:name,x:x,offSet:offSet,liCheng:liCheng,
			linePoint:{x1:x,y1:90,x2:x,y2:110},
			namePoint:{x:(x-5),y:57},
			lichengPoint:{x:(x-10),y:120},
			circlePoint:{x:x,y:75,r:15}
		},
		this.draw = function() {
			var myLine = tdraw.getShap('line',{x1:this.param.x,y1:90,x2:this.param.x,y2:110});
			myLine.draw();
		    
			if(this.param.isLable){
				var nameText = tdraw.getShap('text',{x:(this.param.x-5),y:57,value:this.param.name});
				nameText.fontStyle ='11px Arial';
				nameText.draw();
				var liChengText = tdraw.getShap('text',{x:(this.param.x-10),y:120,value:this.param.liCheng/1000});
				liChengText.fontStyle ='11px Arial';
				liChengText.draw();
			}
			var myCircle = tdraw.getShap('circle',{x:this.param.x,y:75,r:15});
			myCircle.draw();
		};
	};
	//坐标系的左侧信息
	function CoordinateLeft(params,tdraw){
		this.param = params || {//设置参数
			elementTypes:elementTypes,
			hPoint:{x1:35,y1:660,x2:canvase_width,y2:660},
			vPoint:{x1:95,y1:50,x2:95,y2:690},
			dashPoint:{x1:10,y1:150,x2:canvase_width,y2:(150 + 40 * i)},
			dashSpace:40,
			conditionState:0//条件轴的状态，0：默认状态，1：完成测试状态
		},
		this.draw = function() {
			//横坐标系
			var hLine = tdraw.getShap('line',this.param.hPoint);
			
			if(this.param.color){
				hLine.normalStyle.stroke = this.param.color;
			}
			hLine.draw();
			//纵坐标系
			var vLine = tdraw.getShap('line',this.param.vPoint);
			if(this.param.color){
				vLine.normalStyle.stroke = this.param.color;
			}
			vLine.draw();
			//写名称画虚线
			for (var i = 0; i < this.param.elementTypes.length; i++) {
				var myRect = tdraw.getShap('rect',{x: this.param.dashPoint.x1,y: (this.param.dashPoint.y1+1 + this.param.dashSpace * i),width: 95,height: 38,textWidth:95});
				// 矩形内插入文字
				myRect.isLabel = true;
				myRect.selected = false;
				myRect.label = {value:this.param.elementTypes[i].text,point:{x:(this.param.dashPoint.x1 - 38),y:((this.param.dashPoint.y1 + this.param.dashSpace * i) + 12)}};
				myRect.label.labelStyle = '20px Arial';
				myRect.isTextBaseline = true;
				myRect.textAlignRe = "left";
				myRect.textBaseline = 'hanging';
				//如果是默认画小矩形
				myRect.label.fontColor = "#D6D6D4";
				myRect.normalStyle.stroke = '#D6D6D4';
				myRect.filled = true;
				myRect.filledColor = "#3e3e3e";
				myRect.draw();
			}
		};
	};
	
	//分支
	function Branch(params,tdraw){
		this.params = params || 
		{
			x:50,y:50,width:100,height:200
		};
		this.draw = function(){
			//上部矩形
			var topRect = tdraw.getShap('rect',
			{
				x:this.params.x,y:this.params.y,width:this.params.width,
				height:30,filled:true,filledColor:this.params.filledColor,
				isLabel:this.params.isLabel,label:this.params.label,selected:this.params.selected
			});
			topRect.draw();
			
			//分支标示
			var typeSign = tdraw.getShap('image',
			{
				image:imgFenZhi,
				x:this.params.x+3,
				y:this.params.y+4,
				width:20,
				height:20
			});
			typeSign.draw();
			
			//分割矩形
			var spaceRect = tdraw.getShap('rect',
			{
				x:this.params.x+25,y:this.params.y+4,width:3,
				height:20,filled:true,filledColor:'#337ab7',
				isLabel:'false'
			});
			spaceRect.draw();
			
			//条件控件
			for(var i = 0;i<this.params.conditionCount;i++){
				if(this.params.conditionList[i].selected){
					var selectedRect = tdraw.getShap('circle',
					{
						x:this.params.x+this.params.conditionPostion.x+i*this.params.conditionSpace-1+11,
						y:this.params.y+this.params.conditionPostion.y-1+11,
						r:11,
						filled:true,
						filledColor:'#337ab7'
					});
					selectedRect.normalStyle.stroke = '#337ab7';
					selectedRect.draw();
				}
				var typeCondition = tdraw.getShap('image',
				{
					image:imgTiaoJian,
					x:this.params.x+this.params.conditionPostion.x+i*this.params.conditionSpace,
					y:this.params.y+this.params.conditionPostion.y,
					width:20,
					height:20
				});
				typeCondition.draw();
			}
			
			//下部左侧矩形
			var bottomLeftRect = tdraw.getShap('rect',
			{
				x:this.params.x,y:this.params.y + 30,width:this.params.bottomLeftWidth,
				height:(this.params.height - 30),normalStyle:{stroke:'#ffffff'}
			});
			if(this.params.selected){
				bottomLeftRect.filled = true;
				bottomLeftRect.filledColor = selectedColor;
			}
			bottomLeftRect.selected = this.params.selected;
			if(this.params.stateType == 3){//自动测试执行失败
				bottomLeftRect.filled = true;
				bottomLeftRect.filledColor = failColor;
			}
			bottomLeftRect.draw();
			//下部右侧矩形
			var bottomRightRect = tdraw.getShap('rect',
			{
				x:this.params.x+this.params.bottomLeftWidth,y:this.params.y + 30,width:this.params.bottomRightWidth,
				height:(this.params.height - 30),normalStyle:{stroke:'#ffffff'}
			});
			if(this.params.selected){
				bottomRightRect.filled = true;
				bottomRightRect.filledColor = selectedColor;
			}
			bottomRightRect.selected = this.params.selected;
			if(this.params.stateType == 3){//自动测试执行失败
				bottomRightRect.filled = true;
				bottomRightRect.filledColor = failColor;
			}
			bottomRightRect.draw();
		};
	};
	
	//循环
	function Loop(params,tdraw){
		this.params = params || 
		{
			x:50,y:50,width:100,height:200
		};
		this.draw = function(){
			//上部矩形
			var topRect = tdraw.getShap('rect',
			{
				x:this.params.x,y:this.params.y,width:this.params.width,
				height:30,filled:true,filledColor:this.params.filledColor,selected:this.params.selected
			});
			topRect.draw();
			
			//循环标示
			var typeSign = tdraw.getShap('image',
			{
				image:imgXunHuan,
				x:this.params.x+3,
				y:this.params.y+4,
				width:20,
				height:20
			});
			typeSign.draw();
			
			//分割矩形
			var spaceRect = tdraw.getShap('rect',
			{
				x:this.params.x+25,y:this.params.y+4,width:3,
				height:20,filled:true,filledColor:'#337ab7',
				isLabel:'false'
			});
			spaceRect.draw();
			
			//条件控件
			for(var i = 0;i<this.params.conditionCount;i++){
				if(this.params.conditionList[i].selected){
//					var selectedRect = tdraw.getShap('rect',
//					{
//						x:this.params.x+this.params.conditionPostion.x+i*this.params.conditionSpace-1,
//						y:this.params.y+this.params.conditionPostion.y-1,
//						width:22,
//						height:22,
//						filled:true,
//						filledColor:'#337ab7',
//						isLabel:'false'
//					});
					var selectedRect = tdraw.getShap('circle',
					{
						x:this.params.x+this.params.conditionPostion.x+i*this.params.conditionSpace-1+11,
						y:this.params.y+this.params.conditionPostion.y-1+11,
						r:11,
						filled:true,
						filledColor:'#337ab7'
					});
					selectedRect.normalStyle.stroke = '#337ab7';
					selectedRect.draw();
				}
				var typeCondition = tdraw.getShap('image',
				{
					image:imgTiaoJian,
					x:this.params.x+this.params.conditionPostion.x+i*this.params.conditionSpace,
					y:this.params.y+this.params.conditionPostion.y,
					width:20,
					height:20
				});
				typeCondition.draw();
			}
			
			//下部矩形
			var bottomRect = tdraw.getShap('rect',
			{
				x:this.params.x,y:this.params.y + 30,width:this.params.width,
				height:(this.params.height - 30),normalStyle:{stroke:'#ffffff'}
			});
			if(this.params.selected){
				bottomRect.filled = true;
				bottomRect.filledColor = selectedColor;
				bottomRect.selected = true;
				bottomRect.selectStyle.stroke = '#ffffff';
			}
			bottomRect.selected = this.params.selected;
			if(this.params.stateType == 3){//自动测试执行失败
				bottomRect.filled = true;
				bottomRect.filledColor = failColor;
			}
			bottomRect.draw();
		};
	};
	
	//引导箭头
	function Guide(params,tdraw){
		this.params = params || 
		{
			x:50,y:50,width:100,height:200
		};
		this.draw = function(){
			var typeCondition = tdraw.getShap('image',
			{
				image:guideJianTou,
				x:this.params.x,
				y:this.params.y,
				width:69,
				height:25
			});
			typeCondition.draw();
		};
	}
}  
